<?php
/* This file is part of a copyrighted work; it is distributed with NO WARRANTY.
 * See the file COPYRIGHT.html for more details.
 */
 
  require_once("../shared/common.php");
  $tab = "circulation";
  $nav = "view";
  $restrictInDemo = true;
  require_once("../shared/logincheck.php");

  require_once("../classes/SectionQuery.php");
  require_once("../functions/errorFuncs.php");
  require_once("../functions/formatFuncs.php");
  require_once("../classes/Localize.php");
  $loc = new Localize(OBIB_LOCALE,$tab);

  if (count($_GET) != 0) {
      $_POST = $_GET;
  }
  if (count($_POST) == 0) {
    header("Location: ../circ/index.php");
    exit();
  }
  $sectionid = trim($_POST["sectionid"]);
  $mbrid = trim($_POST["mbrid"]);
  
  #**************************************************************************
  #*  Update Section
  #**************************************************************************
  $sectionQ = new SectionQuery();
  $sectionQ->connect();
  
  $section = $sectionQ->get($sectionid);
  if($section == null){
  	$pageErrors["claveone"] = "La clave ONE seleccionada no existe";
  	$_SESSION["postVars"] = $_POST;
  	$_SESSION["pageErrors"] = $pageErrors;
  	header("Location: ../circ/mbr_view.php?mbrid=".U($mbrid));  	
  }
  $section->setMbrid($mbrid);
  
  $sectionQ->updateWithMember($section);
  $sectionQ->close();  
  
  $postVars = $_POST;
  $pageErrors = array();

  unset($_SESSION["postVars"]);
  unset($_SESSION["pageErrors"]);

  header("Location: ../circ/mbr_view.php?mbrid=".U($mbrid));
